#!/usr/bin/env bash
#/usr/bun/env bash haha

which certbot || sudo apt -y install certbot curl

if [[ -z "$1" ]]; then
  echo "Supply a domain name as first argument"
  exit 1
fi

sudo certbot certonly --standalone -d $1 --agree-tos -m cris7fe@outlook.com --no-eff-email
mkdir -p $HOME/sslcerts
sudo -u root ./deploy-scripts/cp_certs $1 $HOME/sslcerts/
sudo chown $USER:$USER $HOME/sslcerts/*

./deploy-scripts/auto_cert_renew $1 $USER

